package com.tvunetworks.center.device.model.dto;


import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @program:
 * @param <T>  t
 * @author HenryChen
 * @create: 11/27/2019 7:01 PM
 **/
@Data
@AllArgsConstructor
public class BelongUserResult<T> {

    /** 不属于当前用户 */
    public static final int NOT_BELONG = -1;

    /** 在 User Device 中查到 */
    public static final int LOCAL_BELONG = 10;

    /** 在 Token (Anywhere Token) 中查到 */
    public static final int TOKEN_BELONG = 20;

    /** 在 Grid Token 中查到 */
    public static final int TOKEN_GRID_BELONG = 30;

    /** 在 Grid (Grid Market) 中查到 */
    public static final int GRID_BELONG = 40;


    /** Grid 属于用户并且配对过 */
    public static final int GRID_LOCAL_PAIRED_BELONG = 60;

    /** Grid 属于用户但没有配对 */
    public static final int GRID_LOCAL_NOT_PAIRED_BELONG = -10;

    /** 在 Grid (Grid Market) 中没有查到 */
    public static final int GRID_NOT_BELONG = -20;

    /** Belong 和 Not Belong 分割线 */
    public static final int BELONG_OR_NOT = 0;


    private int code;
    private T result;

    /**
     *
     * @return BelongUserResult
     */
    public static BelongUserResult notBelong() {
        return new BelongUserResult(NOT_BELONG, null);
    }

    /**
     *
     * @return BelongUserResult
     */
    public static BelongUserResult localBelong() {
        return new BelongUserResult(LOCAL_BELONG, null);
    }

    /**
     *
     * @param requestId requestId
     * @param <T> t
     * @return t
     */
    public  static <T> BelongUserResult gridBelong(T requestId) {
        return new BelongUserResult(GRID_BELONG, requestId);
    }

    /**
     *
     * @param <T> t
     * @return static
     */
    public  static <T> BelongUserResult tokenGridBelong() {
        return new BelongUserResult(TOKEN_GRID_BELONG, null);
    }

    /**
     *
     * @param <T> t
     * @return static
     */
    public  static <T> BelongUserResult gridLocalPairdBelong() {
        return new BelongUserResult(GRID_LOCAL_PAIRED_BELONG, null);
    }

    /**
     *
     * @param <T> t
     * @return static
     */
    public  static <T> BelongUserResult gridLocalNotPairdBelong() {
        return new BelongUserResult(GRID_LOCAL_NOT_PAIRED_BELONG, null);
    }

    /**
     *
     * @param <T> t
     * @return static
     */
    public  static <T> BelongUserResult tokenBelong() {
        return new BelongUserResult(TOKEN_BELONG, null);
    }

    /**
     *
     * @param <T> t
     * @return static
     */
    public  static <T> BelongUserResult gridNotBelong() {
        return new BelongUserResult(GRID_NOT_BELONG, null);
    }


}

